#include<cstdio>
#include<algorithm>
template<class T>void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9') { f|=(ch=='-'); ch=getchar(); }
	while(ch<='9'&&ch>='0') { x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); }
	x = f ? -x : x;
	return ;
}

struct node{
	int v;
	int front=0,last=0;
}list[1010];
int n,m,x;

void _cut(int s)
{
	int f = list[s].front;
	int e = list[s].last;
	list[f].last = e;
	list[e].front = f;
	return ;
}

int main()
{
	read(n);read(m);
	int now = 1;
	for(int i=1;i<=n;++i)
	{
		list[i].v = i;
		list[i].front = i-1;
		list[i].last = i+1;
	}
	list[1].front = n;
	list[n].last = 1;

	int tot=n,cnt=1;

	while(tot>0)
	{
		if(cnt==m)
		{
			cnt=1;
			printf("%d ",list[now].v);
			_cut(now);
			tot--;
			now = list[now].last;
		}
		else
		{
			now = list[now].last;
			cnt++;
		}
	}

	return 0;
}
